<template>
	<view class="header">
		<rui-user-info :more="true" ref="refUserinfo"></rui-user-info>
		<rui-user-card></rui-user-card>
	</view>

	<rui-user-menu @change="change"></rui-user-menu>
	<!-- <rui-user-auth v-if="show_auth"></rui-user-auth> -->
	<rui-card title="温馨提示">
		<view class="tips">
			本系统可免费查询查询身份证归属地，也可查询二次，仅用于旅游行业。
		</view>
		<!-- <view class="tips">
			由于每年服务器费用是一笔大的支出。为大家提供更好的服务，批量查询和查二次仅VIP用户可用。普通用户也可更方便查询身份证归属地。
		</view>
		<view class="tips red">
			VIP用户暂时定价为99元/年。
		</view> -->
	</rui-card>
</template>

<script setup>
	import {
		ref,
		nextTick
	} from "vue"
	import {
		onShow,
		onShareAppMessage,
		onShareTimeline,
		onPageScroll
	} from "@dcloudio/uni-app"
	import share from "@/util/share.js"
	import cache from "@/util/cache.js"

	let show_auth = ref(false)
	
	let refUserinfo = ref(null)

	onShow(() => {
		show_auth.value = cache.get('BaseData').is_share;
		nextTick(() => {
			refUserinfo.value.initData()
		})
	})

	const change = (e, index) => {
		if (e.mode == 'path') {
			uni.$rui.route(e.path);
		}
		if (e.mode == 'phone') {
			uni.makePhoneCall({
				phoneNumber: e.phone
			});
		}
	}

	onShareAppMessage(() => {
		return share.getData()
	})

	onShareTimeline(() => {
		return share.getData()
	})
</script>

<style lang="scss" scoped>
	.header {
		background: #3d7eff;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}

	.red {
		color: #f30;
	}

	.tips {
		margin: 20rpx 0;
	}
</style>